<body>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <input type="hidden" name="type" id="type" value="61">
            <a id="closeBtn" name="backOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a>
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">

            <tbody>
                <tr>
                    <td class="tdc1" style="width:150px;">
                        部门/项目经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="applyUserName" id="applyUserName" data-options="required:true"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="applyUserId" id="applyUserId" value="982">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        录入意见：
                    </td>
                    <td colspan="3">
                        <textarea name="lrOption" id="lrOption" style="width:732px;height:100px"
                            data-options="required:true" class="easyui-validatebox validatebox-text"
                            readonly="readonly"></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        基地（公司）名称：
                    </td>
                    <td colspan="3">
                        <input type="text" name="applyDeptName" id="applyDeptName" data-options="required:true"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="applyDeptId" id="applyDeptId" value="4">

                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        副总经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="deptmanagername" id="deptmanagername"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="deptmanagerid" id="deptmanagerid" value="566">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        总经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="managername" id="managername"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="managerid" id="managerid" value="561">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        董事长：
                    </td>
                    <td colspan="3">
                        <input type="text" name="presidentname" id="presidentname"
                            value="此处根据实际情况选填：原有岗位人员离职后，替补同岗位人员，无需选择董事长审批" class="easyui-validatebox validatebox-text"
                            readonly="">
                        <input type="hidden" name="presidentid" id="presidentid" value="560">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        职位名称：
                    </td>
                    <td style="width:38%;">
                        <input type="text" name="jobTitle" id="jobTitle" readonly=""
                            class="easyui-validatebox validatebox-text">
                    </td>
                    <td class="tdc1" style="width:150px;">
                        需求数量：
                    </td>
                    <td>
                        <input type="text" id="needCount" readonly=""
                            class="easyui-numberbox numberbox-f validatebox-text" numberboxname="needCount"><input
                            type="hidden" name="needCount" value="1">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        工作年限：
                    </td>
                    <td>
                        <input type="text" name="workYear" id="workYear" readonly=""
                            class="easyui-validatebox validatebox-text">
                    </td>
                    <td class="tdc1">
                        职位性质：
                    </td>
                    <td>
                        <select name="jobNature" id="jobNature" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                            <option value="1">全职</option>
                            <option value="2">兼职</option>
                            <option value="3">实习</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        工作地区：
                    </td>
                    <td>
                        <input type="text" name="workPlace" id="workPlace" readonly=""
                            class="easyui-validatebox validatebox-text">
                    </td>
                    <td class="tdc1">
                        职位有效期：
                    </td>
                    <td>
                        <input type="text" name="jobValidity" id="jobValidity" readonly=""
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        学历要求：
                    </td>
                    <td>
                        <input type="text" name="degreeRequired" id="degreeRequired" readonly=""
                            class="easyui-validatebox validatebox-text">
                    </td>
                    <td class="tdc1" "="">
						接收邮箱：
					</td>
					<td>
						<input type=" text" name="receiveEmail" id="receiveEmail" readonly=""
                        class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        公司简介：
                    </td>
                    <td colspan="3">
                        <textarea name="companyProfile" id="companyProfile" readonly=""
                            style="width:732px;height:100px"></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        职位描述：
                    </td>
                    <td colspan="3">
                        <textarea name="jobDescribe" id="jobDescribe" readonly=""
                            style="width:732px;height:100px"></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        任职要求：
                    </td>
                    <td colspan="3">
                        <textarea name="jobSpecification" id="jobSpecification" readonly=""
                            style="width:732px;height:100px"></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        相关附件：
                    </td>
                    <td>
                        <div style="margin-left:10px;">
                            <div id="showFiles"></div>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
    <div style="margin-left:10px;">
        <div id="showRecords">
            <div style="margin-top:8px;margin-bottom:8px;">审核人：韩威<span style="margin-left:15px;">审核时间：2025-10-21
                    11:55:06</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：沈全洪<span style="margin-left:15px;">审核时间：2025-10-22
                    17:12:03</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：张金生<span style="margin-left:15px;">审核时间：2025-10-22
                    17:37:54</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">复核人：王一翀<span style="margin-left:15px;">复核时间：2025-10-23
                    08:43:53</span><span style="margin-left:15px;">复核选项：同意</span><span
                    style="margin-left:15px;">复核意见：同意</span></div>
        </div>
    </div>


    <script>

        var type = $.getUrlParam("type");

        $("#type").val(type);

        var p_id = $.getUrlParam("id");
        var objectId = new Date().getTime();
        var process_id = $.getUrlParam("processid");
        if (process_id != null) {
            $.ajax({
                type: "GET",
                url: contextPath + "manager/approvalprocess/getBeanIdByProcessId/" + process_id + "/" + type,
                data: null,
                dataType: "json",
                success: function (data) {
                    if (data && data.handleMsg.status == 1) {
                        p_id = data.id;
                        if (p_id != null) {
                            objectId = p_id;
                        }
                        loadBassModel(p_id);
                        loadRecord(process_id)
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }

            });
        } else {

            loadBassModel(p_id);
            loadRecord(process_id)
        }

        function loadBassModel(p_id) {
            var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/personRequirement' });
            var baseModel;

            if (p_id == null) {
                baseModel = new BaseModel();
            } else {
                baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
            }
            var baseView = new BaseView({ el: $("#my-form"), model: baseModel });
            if (p_id != null) {
                baseView.doLoad(loadMe);
            }

            function loadMe(model, response, options) {
                if (model.get("approvalProcess")) {
                    $("#applyUserName").val(model.get("approvalProcess").applyUserName);
                    $("#applyUserId").val(model.get("approvalProcess").applyUserId);
                    $("#applyDeptName").val(model.get("approvalProcess").applyDeptName);
                    $("#applyDeptId").val(model.get("approvalProcess").applyDeptId);
                    $("#type").val(model.get("approvalProcess").type);

                }
                getAffixs();
            }
        }
        function getAffixs() {
            $.ajax({
                type: "POST",
                url: contextPath + "affixs",
                data: { "objectType": 611, objectId: objectId },
                dataType: "json",
                success: function (data) {
                    if (data && data.length > 0) {
                        showAffixs(data);
                    } else {
                        $("#showFiles").html("");
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }

            });
        }

        function showAffixs(data) {
            var fileHtml = "";
            for (var i = 0; i < data.length; i++) {
                fileHtml += "<div style=\"margin-top:8px;margin-bottom:8px;\">" + data[i].name;
                fileHtml += "<a style=\"margin-left:10px\" href=\"javascript:\" onclick=\"downfile(" + data[i].id + ")\">下载</a>";
            }
            $("#showFiles").html(fileHtml);
        }


        function downfile(affixId) {
            window.location.href = contextPath + 'affix/' + affixId + '/download';
        }

        ////加载领导审核意见
        function loadRecord(process_id) {
            $.ajax({
                type: "POST",
                url: contextPath + "manager/approvalRecords/listApprovalRecord/" + process_id,
                data: {},
                dataType: "json",
                success: function (data) {
                    if (data) {
                        var rHtml = "";
                        var msg = "审核"
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].userType == 5) {
                                msg = "复核";
                            } else {
                                msg = "审核"
                            }
                            rHtml += "<div style=\"margin-top:8px;margin-bottom:8px;\">" + msg + "人：" + data[i].approvalUser.truename + "";
                            if (data[i].approvalDate == null) {
                                rHtml += "<span style=\"margin-left:15px;\">尚未" + msg + "</span>";
                            } else {
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "时间：" + data[i].approvalDate + "</span>";
                                if (data[i].approvalType == 1) {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：同意</span>";
                                } else {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：不同意</span>";
                                }
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "意见：" + data[i].opinion + "</span>";
                            }
                            rHtml += "</div>";
                        }
                        $("#showRecords").html(rHtml);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }
            });
        }

        var userType = $.getUrlParam("userType");
        if (userType == 5) {
            //复核可以编辑
            $("#approvalBtn").text("复核");
        }

    </script>
    <div id="loading1"
        style="position: absolute; left: 0px; top: 0px; width: 100%; height: 774px; background: rgb(232, 232, 232); opacity: 0.5; z-index: 10000; display: none;">
    </div>
    <div id="loading2" class="panel-loading"
        style="position: fixed; top: 38%; left: 41%; border: 2px solid rgb(149, 184, 231); width: 160px; font-size: 14px; z-index: 10001; background: url(&quot;/system/jquery/themes/themes1/images/loading-1.gif&quot;) 10px 8px no-repeat rgb(255, 255, 255); display: none;">
        正在处理，请稍等...</div>
</body>